import os
from git.repo import Repo
import json

RED_OP = "\033[31m{}\033[0m"
GREEN_OP = "\033[32m{}\033[0m"
YELLOW_OP = "\033[33m{}\033[0m"
BLUE_OP = "\033[34m{}\033[0m"
DEFAULT_OP = "\033[38m{}\033[0m"

local_path = os.path.join(os.path.expanduser("~"), "temp", "yapai")
for file in os.listdir(local_path):
    if os.path.isdir(os.path.join(local_path, file)):
        print("            ")
        print(YELLOW_OP.format(os.path.join(local_path, file)))
        print("            ")
        repo = Repo(os.path.join(local_path, file))
        if repo.is_dirty() is False:
            print(
                BLUE_OP.format("CURRENT BRANCH STATUS = ")
                + GREEN_OP.format(repo.active_branch)
            )
        else:
            print(
                YELLOW_OP.format("CURRENT BRANCH STATUS = ")
                + RED_OP.format(repo.active_branch)
            )
